#pragma once

template<typename T>
bool CompareAndExchange(T* lvalue, const T compare, const T& rvalue)
{
    if (*lvalue == compare)
    {
        *lvalue = rvalue;
        return true;
    }
    return false;
}